<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %>

<rapid:override name="title">
    - 全站用户
</rapid:override>
<rapid:override name="header-style">
    <style>
        /*覆盖 layui*/

        .layui-table {
            margin-top: 0;
        }

        .layui-btn {
            margin: 2px 0 !important;
        }
    </style>
</rapid:override>

<rapid:override name="content">
    <blockquote class="layui-elem-quote">
         <span class="layui-breadcrumb" lay-separator="/">
              <a href="/backIndex/homepage">首页</a>
              <a><cite>全站用户</cite></a>
        </span>
    </blockquote>

    <form class="layui-form" align="right" action="/user/search">
        <div class="layui-form-item">
            <div class="layui-inline">
                <div class="layui-input-inline" style="width:500px;margin-right:-1px">
                    <input type="text" name="search" required autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-inline" style="width:90px;">
                    <select name="searchType" lay-verify="required">
                        <option value="userId">用户id</option>
                        <option value="nickname">昵称</option>
                        <option value="username">用户名</option>
                    </select>
                </div>
                <div class="layui-input-inline" style="width:64px;margin:0px">
                    <button class="layui-btn" style="margin:0px!important">搜索</button>
                </div>
            </div>
        </div>
    </form>

    <table class="layui-table" lay-even lay-skin="nob">
        <colgroup>
            <col width="50">
            <col width="150">
            <col width="150">
            <col width="50">
            <col width="50">
            <col width="50">
        </colgroup>
        <thead>
        <tr>
            <th>用户id</th>
            <th>昵称</th>
            <th>用户名</th>
            <th>性别</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${userList}" var="u">
            <tr>
                <td>
                        ${u.userId}
                </td>
                <td>
                        ${u.nickname}
                </td>
                <td>
                        ${u.username}
                </td>
                <td>
                    <c:choose>
                        <c:when test="${u.sex==0}">男</c:when>
                        <c:when test="${u.sex==1}">女</c:when>
                    </c:choose>
                </td>
                <td>
                    <c:choose>
                        <c:when test="${u.userStatus==0}">
                            <span style="color:#FF5722;">已删除</span>
                        </c:when>
                        <c:otherwise>
                            正常
                        </c:otherwise>
                    </c:choose>
                </td>
                <td>
                    <c:choose>
                        <c:when test="${u.userStatus==1}">
                            <a href="/user/delete/${u.userId}" class="layui-btn layui-btn-danger layui-btn-mini"
                               onclick="return confirmDelete()">删除</a>
                        </c:when>
                        <c:otherwise>
                            <a href="/user/recovery/${u.userId}" class="layui-btn layui-btn layui-btn-mini"
                               onclick="return confirmRecover()">恢复</a>
                        </c:otherwise>
                    </c:choose>
                </td>
            </tr>

        </c:forEach>
        </tbody>
    </table>
    <%@ include file="../Public/paging.jsp" %>

</rapid:override>
<rapid:override name="footer-script">
    <script>

    </script>
</rapid:override>

<%@ include file="../Public/framework.jsp" %>
